package models.decks;

import java.util.*;

import models.cards.ICard;

public abstract class Deck 
{
	
	LinkedList<ICard> deck;
	LinkedList<ICard> discardPile;
	
	public Deck(LinkedList<ICard> deck) {
		this.deck = deck;
		this.discardPile = new LinkedList<ICard>();
	}
	
	public LinkedList<ICard> getDeck() {
		return deck;
	}
	
	public LinkedList<ICard> getDiscardPile() {
		return discardPile;
	}
	
	public void setDeck(LinkedList<ICard> deck) {
		this.deck = deck;
	}
	
	public void setDiscardPile(LinkedList<ICard> discardPile) {
		this.discardPile = discardPile;
	}
	
	public void addToDiscardPile (ICard card) {
		discardPile.add(card);
	}
	
	public void addToDeck (ICard card) {
		deck.add(card);
	}
	
	public ICard drawCard() {
		if (deck.size() > 0) {
			ICard card = deck.getLast();			
			deck.removeLast();
			return card;
		} else {
			return new ICard() {
				
				@Override
				public String getName() {
					return "The deck is empty!";
				}
			};
		}
	}
	
	public void shuffleDeck() {
		Collections.shuffle(deck);
	}

}
